package com.ycfmedical.bed.ui.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.ycfmedical.bed.R;
import com.ycfmedical.bed.adapter.HisNursedRecordsAdapter;
import com.ycfmedical.bed.local.DataManager;
import com.ycfmedical.bed.local.entity.HisNurseRecordsMsg;
import com.ycfmedical.bed.present.HisNursedRecordsPresenter;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import cn.droidlover.xdroidmvp.mvp.XFragment;
import cn.droidlover.xrecyclerview.XRecyclerContentLayout;

/**
 * Created by yf 2017-05-01.
 */

public class HisNursedRecordsFragment extends XFragment<HisNursedRecordsPresenter> {
    @BindView(R.id.billRecords)
    XRecyclerContentLayout billRecords;
    @BindView(R.id.billResult)
    XRecyclerContentLayout billResult;
    Unbinder unbinder;
    HisNursedRecordsAdapter adapter;

    @Override
    public void initData(Bundle savedInstanceState) {

        billResult.setVisibility(View.GONE);
        adapter = new HisNursedRecordsAdapter(getContext());
        billRecords.getRecyclerView().verticalLayoutManager(getContext());
        billRecords.getRecyclerView().setAdapter(adapter);
        if(null!= DataManager.getInstance().getUser()){
            getP().loadData();
        }
    }

    public void showData(List<HisNurseRecordsMsg> hisNurseRecordsMsgs) {
        adapter.setData(hisNurseRecordsMsgs);
        adapter.notifyDataSetChanged();
    }
    @Override
    public int getLayoutId() {
        return R.layout.fragment_his_billcheck;
    }

    @Override
    public HisNursedRecordsPresenter newP() {
        return new HisNursedRecordsPresenter();
    }


}
